package com.ruoyi.zyx.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zyx.mapper.ZyxCheckMapper;
import com.ruoyi.zyx.domain.ZyxCheck;
import com.ruoyi.zyx.service.IZyxCheckService;

/**
 * 检定基础信息Service业务层处理
 *
 * @author lhs
 * @date 2021-06-02
 */
@Service
public class ZyxCheckServiceImpl implements IZyxCheckService
{
    @Autowired
    private ZyxCheckMapper zyxCheckMapper;

    /**
     * 查询检定基础信息
     *
     * @param id 检定基础信息ID
     * @return 检定基础信息
     */
    @Override
    public ZyxCheck selectZyxCheckById(Long id)
    {
        return zyxCheckMapper.selectZyxCheckById(id);
    }

    @Override
    public ZyxCheck getByDeviceId(Long deviceid) {
        return zyxCheckMapper.getByDeviceId(deviceid);
    }

    /**
     * 查询检定基础信息列表
     *
     * @param zyxCheck 检定基础信息
     * @return 检定基础信息
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "")
    public List<ZyxCheck> selectZyxCheckList(ZyxCheck zyxCheck)
    {
        return zyxCheckMapper.selectZyxCheckList(zyxCheck);
    }

    @Override
    public List<ZyxCheck> listMyCheck(ZyxCheck zyxCheck) {
        return zyxCheckMapper.selectZyxCheckList(zyxCheck);
    }

    /**
     * 新增检定基础信息
     *
     * @param zyxCheck 检定基础信息
     * @return 结果
     */
    @Override
    public int insertZyxCheck(ZyxCheck zyxCheck)
    {
        zyxCheck.setCreateTime(DateUtils.getNowDate());
        return zyxCheckMapper.insertZyxCheck(zyxCheck);
    }

    /**
     * 修改检定基础信息
     *
     * @param zyxCheck 检定基础信息
     * @return 结果
     */
    @Override
    public int updateZyxCheck(ZyxCheck zyxCheck)
    {
        zyxCheck.setUpdateTime(DateUtils.getNowDate());
        return zyxCheckMapper.updateZyxCheck(zyxCheck);
    }

    /**
     * 批量删除检定基础信息
     *
     * @param ids 需要删除的检定基础信息ID
     * @return 结果
     */
    @Override
    public int deleteZyxCheckByIds(Long[] ids)
    {
        return zyxCheckMapper.deleteZyxCheckByIds(ids);
    }

    /**
     * 删除检定基础信息信息
     *
     * @param id 检定基础信息ID
     * @return 结果
     */
    @Override
    public int deleteZyxCheckById(Long id)
    {
        return zyxCheckMapper.deleteZyxCheckById(id);
    }

    @Override
    public int delByDeviceId(Long id) {
        return zyxCheckMapper.delByDeviceId(id);
    }
}
